package io;


import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class TestNote {
    public static void main(String[] args) throws IOException {
        Scanner scan = new Scanner(System.in);
        FileOutputStream fos = new FileOutputStream("fos.txt");
        System.out.println("请输入数据,单独输入exit退出");
        while(true){
            String str = scan.nextLine();
            byte[] bytes = str.getBytes(StandardCharsets.UTF_8);
            if (str.endsWith("exit")){
                System.out.println("程序结束");
                break;
            }else {
                fos.write(bytes);
            }
        }
        fos.close();
    }
}
